From: Florian Müllner Date: Thu, 25 Jul 2019 20:26:19 +0000 (+0200) Subject: ci: Fix identifying commits in MR X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~839^2^2~114 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1b7ff760924d9a8544f32da937e89d0e23de68b2;p=gnome-shell.git ci: Fix identifying commits in MR When a MR uses a private namespace, "origin" refers to that, and its master branch may be outdated with regard to upstream master. We are really only interested in checking the line changes from the commits in the MR, so figure out the correct branch point instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/647 --- diff --git a/.gitlab-ci/run-eslint.sh b/.gitlab-ci/run-eslint.sh index 4732f986f..0f745a58d 100755 --- a/.gitlab-ci/run-eslint.sh +++ b/.gitlab-ci/run-eslint.sh @@ -67,7 +67,10 @@ create_common() { } if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then - commit_range=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME...$CI_COMMIT_SHA + git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + branch_point=$(git merge-base HEAD FETCH_HEAD) + commit_range=$branch_point...$CI_COMMIT_SHA + list_commit_range_additions $commit_range > $LINE_CHANGES # Don't bother with running lint when no JS changed